package com.exam.system.service.impl;

import com.exam.system.dao.ExamUserDao;
import com.exam.system.entity.ExamUser;
import com.exam.system.service.ExamStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional
public class ExamStudentServiceImpl implements ExamStudentService {
    @Autowired
    private ExamUserDao examUserDao;

    @Override
    public List<ExamUser> findAllStudent() {
        return examUserDao.findAllStudent();
    }

    @Override
    public ExamUser findStudentById(Integer id) {
        return examUserDao.findStudentById(id);
    }

    @Override
    public void updateById(ExamUser examUser) {
        examUserDao.updateById(examUser);
    }

    @Override
    public ExamUser insertStudent(ExamUser examUser) {
        examUser.setRoleId(4);
        examUser.setCreateTime(new Date());
       examUser.setScore(100);
       examUser.setStatus("n");
       examUser.setGender(1);
        examUserDao.insertStudent(examUser);
        return null;
    }
}
